<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}


<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-donation-edit">
		<input type="hidden" class="input-text" value="{$donation['id']}" placeholder="" id="id" name="id">

		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-xs-6 col-sm-7">
				{$donation['full_name']}
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>手机：</label>
			<div class="formControls col-xs-6 col-sm-7">
				{$donation['tel']}
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>捐赠书名：</label>
			<div class="formControls col-xs-6 col-sm-7">
				<input type="text" class="input-text" value="{$donation['donation_book']}" placeholder="" id="donation_book" name="donation_book">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>书籍价格：</label>
			<div class="formControls col-xs-6 col-sm-7">
				<input type="text" class="input-text" value="{$donation['donation_price']}" placeholder="" id="donation_price" name="donation_price">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-6 col-sm-7 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary size-M radius" type="submit" value="提交">
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn6 size-M radius" type="button">取消</button>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}


<script type="text/javascript">
	$("#form-donation-edit").validate({
		rules:{
			donation_book:{
				required:true
			},
			donation_price:{
				required:true
			}
		},
		message:{
			donation_book:{
				required:"捐赠的书籍名称必须填写"
			},
			donation_price:{
				required:"捐赠的书籍的价格必须填写"
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('donation/edit_donation')}",
				dataType: 'json',
				data: data,
				success: function(rec){
					if(rec.status == true){
						layer.msg(rec.message,{icon: 6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							parent.location.reload();
						}
					}else if(rec.status == false){
						layer.msg(rec.message,{icon: 5,time:2000});
					}
				}
			});
			//var index = parent.layer.getFrameIndex(window.name);
			//parent.$('.btn-refresh').click();
			//parent.layer.close(index);
		}
	});

</script> 
